<template>
  <div>
    <van-field
      :type="type"
      :label="label"
      :placeholder="placeholder"
      v-model="content"
    />
  </div>
</template>

<script>
export default {
  props: ['label', 'placeholder', 'type', 'rule'],
  data() {
    return {
      content: ''
    }
  },
  methods: {},
  watch: {
    content() {
      const rule = new RegExp(this.rule)
      const flag = rule.test(this.content)
      this.$emit('inputHandler', { value: this.content, flag })
    }
  }
}
</script>

<style></style>
